package com.dlwx.firefighting.views;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.dlwx.firefighting.R;

/**
 * Created by Administrator on 2018/3/21.
 */

public class SimplePaddingDecoration extends RecyclerView.ItemDecoration {
    private int dividerHeight;


    public SimplePaddingDecoration(Context context) {
        dividerHeight = context.getResources().getDimensionPixelSize(R.dimen.size_6dp);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
//        outRect.left = dividerHeight;  //相当于 设置 left padding
//        outRect.top = dividerHeight;   //相当于 设置 top padding
//        outRect.bottom = dividerHeight;  //相当于 设置 bottom padding
        outRect.right = dividerHeight; //相当于 设置 right padding
    }

}
